<template>
  <el-container class="container">
    <el-header class="header">
      <el-row>
        <el-col :span="11">
          <div class="grid-content bg-purple">
            <div class="logo"></div>
          </div>
        </el-col>
        <el-col class="tiaozheng" :span="10">
          <div class="grid-content bg-purple-light">
            <h1>物流管理系统</h1>
          </div>
        </el-col>
        <el-col :span="3">
          <div class="grid-content bg-purple-light">
            <el-button class="tuichu" type="primary" @click="tuichu()">退出</el-button>
          </div>
        </el-col>
      </el-row>
    </el-header>
    <el-container>
      <el-aside class="aside">
        <el-row>
          <el-col :span="12">
            <el-menu
              :router="true"
              default-active="2"
              class="el-menu-vertical-demo"
              background-color="#545c64"
              text-color="#fff"
              active-text-color="#ffd04b"
            >
              <el-submenu index="1">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>用户管理</span>
                </template>
                <el-submenu index="1-4">
                  <template slot="title">用户管理</template>
                  <el-menu-item index="users">users</el-menu-item>
                  <el-menu-item index="1-4-1">users2</el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="2">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>权限管理</span>
                </template>
                <el-submenu index="2-4">
                  <template slot="title">选项4</template>
                  <el-menu-item index="2-4-1">选项1</el-menu-item>
                  <el-menu-item index="2-4-1">选项2</el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="3">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>商品管理</span>
                </template>
                <el-submenu index="3-4">
                  <template slot="title">选项4</template>
                  <el-menu-item index="3-4-1">选项1</el-menu-item>
                  <el-menu-item index="3-4-1">选项2</el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="4">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>订单管理</span>
                </template>
                <el-submenu index="4-4">
                  <template slot="title">选项4</template>
                  <el-menu-item index="4-4-1">选项1</el-menu-item>
                  <el-menu-item index="4-4-1">选项2</el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="4">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>数据统计</span>
                </template>
                <el-submenu index="4-4">
                  <template slot="title">选项4</template>
                  <el-menu-item index="4-4-1">选项1</el-menu-item>
                  <el-menu-item index="4-4-1">选项2</el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="5">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>物流管理</span>
                </template>
                <el-submenu index="5-4">
                  <template slot="title">选项4</template>
                  <el-menu-item index="5-4-1">选项1</el-menu-item>
                  <el-menu-item index="5-4-1">选项2</el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="6">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>用户流量</span>
                </template>
                <el-submenu index="6-4">
                  <template slot="title">选项4</template>
                  <el-menu-item index="6-4-1">选项1</el-menu-item>
                  <el-menu-item index="6-4-1">选项2</el-menu-item>
                </el-submenu>
              </el-submenu>
              <el-submenu index="7">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>关于信息</span>
                </template>
                <el-submenu index="7-4">
                  <template slot="title">选项4</template>
                  <el-menu-item index="7-4-1">选项1</el-menu-item>
                  <el-menu-item index="7-4-1">选项2</el-menu-item>
                </el-submenu>
              </el-submenu>
            </el-menu>
          </el-col>
        </el-row>
      </el-aside>
      <el-main class="main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  components: {},
  data() {
    return {};
  },
  computed: {},
  watch: {},
  methods: {
    tuichu() {
      localStorage.clear("token");
      this.$message.success("退出成功");
      this.$router.push({ name: "Login" });
    }
  },
  created() {},
  mounted() {},
  beforeCreate() {
    const token = localStorage.getItem("token");
    if (!token) {
      this.$router.push({ name: "Login" });
      this.$message.error("请先登入页面");
    }
  }
};
</script>
<style>
.container {
  height: 100%;
}
.header {
  background-color: #b3c0d1;
}
.aside {
  background-color: #d3dce6;
}
.main {
  background-color: #e9eef3;
}
.logo {
  width: 192px;
  height: 200px;
  background: url("../assets/images/logo.png") no-repeat center center;
  background-size: 100%;
  background-position: 2px 4px;
}
.tiaozheng {
  line-height: 20px;
}
.tuichu {
  margin-top: 10px !important;
}
.el-menu-vertical-demo {
  width: 300px;
}
</style>